package com.sec.android.app.myfiles.thumbnail;

import android.content.Context;
import android.graphics.Bitmap;
import android.provider.MediaStore.Video.Thumbnails;

import com.sec.android.app.myfiles.info.FileType;
import com.sec.android.app.myfiles.log.Log;
import com.sec.android.app.myfiles.module.abstraction.FileRecord;

public class VideoThumbnailImp extends ThumbnailImp {

    public VideoThumbnailImp(Context context) {
        super(context);
    }

    @Override
    protected boolean isSupport(FileRecord record) {
        return FileType.isVideoFileType(record.getFileType());
    }

    @Override
    public Bitmap _createThumbnail(FileRecord record, int thumbnailSize) {
        Bitmap ret = android.media.ThumbnailUtils.createVideoThumbnail(record.getFullPath(), Thumbnails.MINI_KIND);

        if (ret == null) {
            Log.d(this, "record " + record.getName() + " ret = null");
        }

        return ret;
    }

}
